#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int minDifference(vector<int>& a) {
        sort(a.begin(), a.end());
        long long ret = a[1] - a[0];
        for (int i = 2; i < a.size(); i++) ret = min(ret, (long long)a[i] - (long long)a[i - 1]);
        return ret;
    }
};